package edu.cmu.ibill.util;

/**
 * 
 * @author Yunkai Zhang 15-637
 */

public class validator {

	public static boolean isValidEmail(String email) {
		if (email == null || email.length() >= 80)
			return false;
		String[] tmp = email.split("@");
		if (tmp.length != 2)
			return false;
		else if (tmp[0].length() == 0 || tmp[1].length() == 0)
			return false;
		return true;
	}

	public static boolean isValidURL(String url) {

		if (url == null || url.length() == 0)
			return false;
		if (url.charAt(0) == '.')
			return false;
		else if (url.charAt(url.length() - 1) == '.')
			return false;
		else if (url.contains("."))
			return true;
		else
			return false;
	}

}
